package cn.kg.spring.service.impl;

import cn.kg.spring.anno.Auto;
import cn.kg.spring.mapper.UserMapper;
import cn.kg.spring.service.UserService;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/4/25
 * @Description:
 */
public class UserServiceImpl implements UserService {

    // 代码耦合
    //private UserMapper userMapper = new UserMapperImpl();
    // 从工厂获取对象
    //private UserMapper userMapper = BeanFactory.getUserMapperImpl();
    // 反射
    //private UserMapper userMapper = (UserMapper) BeanFactory.getBean("cn.kg.spring.mapper.impl.UserMapperImpl");
    // 反射+ 配置文件
    //private UserMapper userMapper = (UserMapper) BeanFactory.getBean("userMapper");

    //private UserMapper userMapper = BeanFactory.getBean("userMapper",UserMapper.class);

    @Auto
    private UserMapper userMapper ;

    private String name;

    public String  add(){
        Integer add = userMapper.add();
        return "UserService add() ok line = " +add;
    }

}
